﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using FXSStation.Modules.SharedInfrastructureModule.Events;

namespace FXSStation.Modules.ChartModule
{
    /// <summary>
    /// Interaction logic for BuyOrderWindow.xaml
    /// </summary>
    public partial class BuyOrderWindow : UserControl
    {
        public event NewOrderEventHandler PostBuyOrder;

        public BuyOrderWindow()
        {
            InitializeComponent();
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            int amount = 0;
            if (int.TryParse(tbAmount.Text, out amount))
            {
                NewOrderEventArgs args = new NewOrderEventArgs(amount);
                PostBuyOrder(null, args);
            }
            else
            {
                MessageBox.Show("Invalid Amount");
            }
        }

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            (this.Parent as Window).Close();
        }
    }
}
